<template>
<div>
  <div class="header">
   <van-nav-bar
  title="个人中心"
  left-text="返回"
  right-text="退出"
  left-arrow
  @click-left="$router.go(-1)"
  @click-right="onClickRight"
/>
  </div>
  <div class="body">
   <p>个人中心</p>
   <van-cell title="地址管理" is-link to="/adress" />
   <van-cell title="订单中心" is-link to="/order" />
  </div>
  </div>
</template>
<script setup>
import { Dialog } from 'vant';
import {useRouter}from "vue-router"
import {useuserstore} from "../store/userstore"
import{ref} from 'vue'
let router =useRouter()
let userstore=useuserstore()
let onClickRight=()=>{
    Dialog.confirm({
      title: '提示',
      message:`确认要退出吗`,
       }).then(() => {
      //  清空token和pinia
       localStorage.removeItem("token")
        localStorage.removeItem("userid")
       userstore.setuserid("")
       router.push("/home")
      }).catch(() => {
      });
}
</script>
<style scoped lang="scss">
.body{
  p{
    margin-left: 15px;
  }
}

</style>